sgdk
vdp_pal.h
Go to the documentation of this file.
00001 
00012 #ifndef _VDP_PAL_H_
00013 #define _VDP_PAL_H_
00014 
00015 
00016 #define VDPPALETTE_REDSFT           9
00017 #define VDPPALETTE_GREENSFT         5
00018 #define VDPPALETTE_BLUESFT          1
00019 
00020 #define VDPPALETTE_REDMASK          0x0E00
00021 #define VDPPALETTE_GREENMASK        0x00E0
00022 #define VDPPALETTE_BLUEMASK         0x000E
00023 #define VDPPALETTE_COLORMASK        0x0EEE
00024 
00032 #define RGB24_TO_VDPCOLOR(color)    (((color >> ((2 * 4) + 4)) & VDPPALETTE_REDMASK) | ((color >> ((1 * 4) + 4)) & VDPPALETTE_GREENMASK) | ((color >> ((0 * 4) + 4)) & VDPPALETTE_BLUEMASK))
00033 
00034 
00045 typedef struct
00046 {
00047     u16 index;
00048     u16 length;
00049     u16 *data;
00050 } Palette;
00051 
00052 
00057 extern const u16* const palette_black;
00062 extern const u16 palette_grey[16];
00067 extern const u16 palette_red[16];
00072 extern const u16 palette_green[16];
00077 extern const u16 palette_blue[16];
00078 
00079 
00088 u16  VDP_getPaletteColor(u16 index);
00100 void  VDP_getPaletteColors(u16 index, u16* dest, u16 count);
00110 void VDP_getPalette(u16 index, u16 *pal);
00111 
00121 void VDP_setPaletteColor(u16 index, u16 value);
00133 void VDP_setPaletteColors(u16 index, u16* values, u16 count);
00143 void VDP_setPalette(u16 num, const u16 *pal);
00144 
00145 
00146 // these functions should be private as they are called by VDP_fadeXXX functions internally
00147 // but they can be useful sometime for better control on the fading processus
00148 u16  VDP_doStepFading(u16 waitVSync);
00149 u16  VDP_initFading(u16 fromcol, u16 tocol, const u16 *palsrc, const u16 *paldst, u16 numframe, u16 waitVSync);
00150 
00151 
00156 void VDP_interruptFade();
00157 
00180 void VDP_fade(u16 fromcol, u16 tocol, const u16 *palsrc, const u16 *paldst, u16 numframe, u8 async);
00199 void VDP_fadeTo(u16 fromcol, u16 tocol, const u16 *pal, u16 numframe, u8 async);
00216 void VDP_fadeOut(u16 fromcol, u16 tocol, u16 numframe, u8 async);
00235 void VDP_fadeIn(u16 fromcol, u16 tocol, const u16 *pal, u16 numframe, u8 async);
00236 
00256 void VDP_fadePal(u16 numpal, const u16 *palsrc, const u16 *paldst, u16 numframe, u8 async);
00273 void VDP_fadePalTo(u16 numpal, const u16 *pal, u16 numframe, u8 async);
00288 void VDP_fadePalOut(u16 numpal, u16 numframe, u8 async);
00305 void VDP_fadePalIn(u16 numpal, const u16 *pal, u16 numframe, u8 async);
00306 
00323 void VDP_fadeAll(const u16 *palsrc, const u16 *paldst, u16 numframe, u8 async);
00339 void VDP_fadeAllTo(const u16 *pal, u16 numframe, u8 async);
00353 void VDP_fadeOutAll(u16 numframe, u8 async);
00369 void VDP_fadeInAll(const u16 *pal, u16 numframe, u8 async);
00370 
00375 u16 VDP_isDoingFade();
00380 void VDP_waitFadeCompletion();
00381 
00382 
00383 #endif // _VDP_PAL_H_
 All Classes Files Functions Variables Typedefs Enumerations Defines